package com.tryedhp.jetpackdemo.activity

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Toast
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LifecycleRegistry
import com.tryedhp.jetpackdemo.MyObserver
import com.tryedhp.jetpackdemo.R

class LifeCyclerActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_life_cycler)
        lifecycle.addObserver(MyObserver(object : MyObserver.CallBack {
            override fun update(string: String) {
                Toast.makeText(this@LifeCyclerActivity, string, Toast.LENGTH_SHORT).show()
            }
        }))
    }

}
